package site.wanjiahao.handler.server;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import site.wanjiahao.message.request.PingMessage;
import site.wanjiahao.message.response.PongMessage;

public class PingMessageHandler extends SimpleChannelInboundHandler<PingMessage> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, PingMessage msg) throws Exception {
        // 向客户端发送一个数据包，证明双方通信能力正常
        ctx.writeAndFlush(new PongMessage());
    }
}
